{% extends 'base.html' %}
{% import 'page_macro.html' as pg %}


{% block title %}首页{% endblock %}

{% block head %}{% endblock %}

{% block nav %}{% endblock %}

{% block style %}
    {{ super() }}
    <link rel="stylesheet" href="{{ url_for('static',filename='css/index.css') }}">
    <link rel="stylesheet" href="{{ url_for('static',filename='css/paginate.css') }}">
{% endblock %}

{#导航栏上方大屏幕#}
{% block jumbotron_box %}
    {{ super() }}
{% endblock %}


{#这里是主文字区#}
{% block body %}
    {{ super() }}
{% endblock %}

{#侧边分类#}
{% block body_category %}
    <ul class="nav nav-pills flex-column">
        <li class="nav-item">
            <a class="nav-link active" href="{{ url_for('article.index',page=1) }}">全部</a>
        </li>
        {% if categories %}
            {% for category in categories %}
                <li class="nav-item">
                    <a class="nav-link" href="{{ url_for('article.kind_index',page=1,category_id=category.id) }}">{{ category.name }}</a>
                </li>
            {% endfor %}
        {% endif %}
    </ul>
{% endblock %}

{% block body_article %}
    {#{{ super() }}#}
    {% if articles %}
        {% for article in articles.items %}
            <div class="art_list">
                <a href="{{ url_for("article.detail_index",art_id=article.id) }}" class="nav-link" target="_blank">
                    <h2>{{ article.title }}</h2>
                </a>
{#                <div class="art_img"><img src="" alt="图片"></div>#}
                <p>{{ article.explain|truncate(200) }}</p>
                <span class="time">{{ article.create_time }}</span>
                <span class="category"><a class="nav-link" href="{{ url_for('article.kind_index',page=1,category_id=article.category.id) }}">类别:{{ article.category.name }}</a></span>
            </div>
        {% endfor %}
        <div style="text-align: center">{{ pg.page(articles,'article.index') }}</div>
    {% endif %}
{% endblock %}
{#主文字区结束#}